<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body ng-controller="Ctrl as c">

<!-- debounce: 3000 3秒后才更新ng-model里的值 -->
<form name="myForm" ng-submit="c.submit()" ng-model-options="{debounce:3000}" novalidate>
    姓名: <input type="text" ng-model="c.user.name"/>
    <br/>
    年龄: <input type="number" ng-model="c.user.age" min="0"/>
    <br/>
    <button type="submit">提交</button>
</form>
<hr/>
用户详情：<span ng-bind="c.user|json"></span>
<script src="../../../../../../../bower_components/angular/angular.js"></script>
<script>
    var app = angular.module('app', []);
    app.controller('Ctrl', ['$scope', '$timeout', function ($scope, $timeout) {
        var vm = this;
        vm.submit = function () {
            console.log($scope.myForm);
        };

        // 等待 angular 把dom解析完成及页面渲染完成
        $timeout(function () {
            console.log($scope.myForm);
        });
    }]);
</script>
</body>
</html>